<?php

class Customer_PaymentController extends Zend_Controller_Action
{
	protected $_session;
	
    private function _getCustomerNS()
    {
		if($this->_session == null) {
			$this->_session = new Zend_Session_Namespace('Customer');
		}
		return $this->_session;
    }

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        
    }    

	public function receiveCodeAction()	
	{		
		// get params from session
		$tripID = $this->_getCustomerNS()->tripID;
		$seatCountYouWant = $this->_getCustomerNS()->seatCountYouWant;
		$selectedSeatNumbers = $this->_getCustomerNS()->selectedSeatNumbers;		
		$code = $this->_getCustomerNS()->code;
		
		// get trip info
		$tripModel = new Customer_Model_Trip();
		$trip = $tripModel->getTripInfo($tripID);		
		if($trip == null) {
			throw new Exception('You can\'t reach here');
		}		
		
		// assign params to view
		$this->view->from_city = $trip['from_city'];
		$this->view->to_city = $trip['to_city'];
		$this->view->departure_time = $trip['departure_time'];
		$this->view->boarding_point = $trip['boarding_point'];
		$this->view->fare = $trip['fare'];
		$this->view->code = $code;		
		$this->view->seatCountYouWant = $seatCountYouWant;
		$this->view->selectedSeatNumbers = $selectedSeatNumbers;		
	}
}

